 <!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
	<head th:replace="admin/_fragments::head(~{::title})">
		<meta charset="utf-8" />
		<title>博客管理</title>
		<script src="  https://cdn.bootcdn.net/ajax/libs/jquery/3.5.1/jquery.js " type="text/javascript" charset="utf-8"></script>
		<script src="https://cdn.jsdelivr.net/semantic-ui/2.2.4/semantic.min.js"></script>
		
		<link rel="stylesheet" href="https://cdn.jsdelivr.net/semantic-ui/2.2.4/semantic.min.css">
		<link rel="stylesheet" href="../../static/lib/md/css/editormd.min.css" />
			<link rel="stylesheet" href="../../static/css/mi1.css">
	</head>
	<body>
		
		
		<nav th:replace="admin/_fragments::menu(1)" class="ui inverted attached segment m-padded-tb-mini m-shadow-small" >
			<div class="ui container">
			<div class="ui menu inverted secondary stackable">
				<h2 class="ui teal header item">管理后台</h2>
				<a href="#" class="m-item m-mobile-hide item"><i class="mini idea icon"></i>博客</a>
				<a href="#" class="m-item m-mobile-hide item"><i class="mini idea icon"></i>分类</a>
				<a href="#" class="m-item m-mobile-hide item"><i class="mini tags icon"></i>标签</a>
				<div class="right m-item m-mobile-hide menu">
					<div class="ui dropdown item">
						    <div class="text">
						      <img class="ui avatar image" src="http://temp.im/100x100">
						      脏丽丽
						    </div>
						    <i class="dropdown icon"></i>
						    <div class="menu">
						      <a href="#" class="item">注销</a>
						    </div>
						  
					</div>
				</div>
			</div>
			</div>
			<a href="#" class="ui black menu toggle icon button m-right-top m-mobile-show">
				<i class="sidebar icon"></i>
			</a>
		</nav>
		<div class="ui attached pointing menu">
			<div class="ui container">
				<div class="right menu">
					<a href="#" class=" teal active item" th:href="@{/admin/blogs/input}">发布</a>
					<a href="" class="  item " th:href="@{/admin/blogsShow}">列表</a>
					
				</div>
				
			</div>
		</div>
		<!-- 中间内容 -->
		<div class="m-container-sm m-padded-tb-big">
			<!-- header -->
		    <div class="ui container">
				
				<form id="blog-form" action="#" th:action="@{/admin/blogsSave}" th:object="${blog}" method="post" class="ui form">
					<input type="hidden" name="published">
					<input type="hidden" name="id" th:value="*{id}">
				<div class="required field">
					
					<div class="ui left labeled input">
						<div class="ui  selection compact teal basic dropdown label">
							<input type="hidden" value="原创" name="flag" th:value="*{flag}">
							<i class="dropdown icon"></i>
							
							<div class=" text">原创</div>
							<div class="menu">
								<div class="item" data-value="原创">原创</div>
								<div class="item" data-value="转载">转载</div>
								<div class="item" data-value="翻译">翻译</div>
							</div>
						</div>
							<input type="text" name="title" placeholder="标题" th:value="*{title}">
						
						</div>
					</div>
					<div class="field required">
						<div id="md-content" style="z-index: 1 !important;">
							
						<textarea placeholder="博客内容" name="content" style="display: none" th:text="*{content}">

						</textarea>
						</div>
					</div>
					<div class="two fields">
						<div class="field required">
							<div class="ui left labeled action input">
								<label class="ui compact teal basic label">分类</label>
								<div class="ui fluid multiple search selection dropdown">
									<input type="hidden" name="typeId" th:value="*{typeId}">
									<i class="dropdown icon" ></i>
									<div class="default text">
										分类
									</div>
									<div class="menu">
										<div th:each="type : ${types} " th:data-value="${type.id}" th:value="${type.id}" th:text="${type.name}" class="item" data-value="1">错误日志</div>
<!--										<div class="item" data-value="2">开发者手册</div>-->
									</div>
									
								</div>
							</div>
						</div>
						<div class="field">
							<div class="ui left labeled action input">
								<label class="ui compact teal basic label">标签</label>
								<div class="ui fluid multiple search selection dropdown">
									<input type="hidden" name="tagId" th:value="*{tagId}">
									<i class="dropdown icon"></i>
									<div class="default text">
										标签
									</div>
									<div class="menu">
										<div  class="item" th:each="tag : ${tags} " th:data-value="${tag.id}" th:value="${tag.id}" th:text="${tag.name}" data-value="1">java</div>
<!--										<div class="item" data-value="2">js</div>-->
									</div>
									
								</div>
							</div>
						</div>
					</div>
					<div class="field required">
						<div class="ui left labeled input">
						<label for="" class="ui teal basic label">首图</label>
						<input type="text" name="firstPicture" placeholder="首图引用地址" th:value="*{firstPicture}">
							
						</div>
					</div>
					<div class="field required">
						<div id="md-description" style="z-index: 1 !important;">

						<textarea placeholder="博客描述" name="description"  th:text="*{description}">

						</textarea>
						</div>
					</div>
					<div class="inline fields">
						<div class="field ">
							<div class="ui checkbox">
								<input type="checkbox" name="recommend" checked="" id="recommend" class="hidden" th:checked="*{recommend}">
							    <label for="recommend">推荐</label>
							</div>
						</div>
						<div class="field ">
							<div class="ui checkbox">
								<input type="checkbox" name="shareStatement" id="shareStatement" class="hidden" th:checked="*{shareStatement}">
							    <label for="shareStatement">转载声明</label>
							</div>
						</div>
						<div class="field " >
							<div class="ui checkbox">
								<input type="checkbox" name="appreciation" id="appreciation" class="hidden" th:checked="*{appreciation}">
							    <label for="appreciation">赞赏</label>
							</div>
						</div>
						<div class="field ">
							<div class="ui checkbox">
								<input type="checkbox" name="commentabled" id="commentabled" class="hidden" th:checked="*{commentabled}">
							    <label for="commentabled">评论</label>
							</div>
						</div>
					</div>
					<div class="ui error message"></div>
					<div class="ui right aligned container">
						<button type="button" class="ui button" onclick="window.history.go(-1)">返回</button>
					     <button type="button" id="save-btn" class="ui secondary button">保存</button>
						 <button type="button" id="publish-btn" class="ui teal button">发布</button>
					</div>

				</form>
			</div>
		</div>
		<br />
		<br />
		<br />
		<footer  th:replace="_fragments::footer" class="ui inverted vertical segment m-padded-tb-massive">
			<div class="ui center aligned  container">
			<div class="ui inverted divided grid stackable">
				<div class="three wide column">
					<div class="inverted ui link list">
					<div class="item">
						<img src="../../static/img/小俊男.jpg" style="width:110px " alt="" class="ui rounded image">
						
					</div>
					</div>
				</div>
				<div class="three wide column">
					<div class="ui inverted link list">
						<h4 class="ui inverted header m-text-thin m-text-spaced">最新博客</h4>
						<a href="#" class="item">用户登录</a>
						<a href="#" class="item">用户登录</a>
						<a href="#" class="item">用户登录</a>
					</div>
					
				</div>
				<div class="three wide column">
					<div class="ui inverted link list">
						<h4 class="ui inverted header m-text-thin m-text-spaced" >最新博客</h4>
						<a href="#" class="item">用户登录</a>
						<a href="#" class="item">用户登录</a>
						<a href="#" class="item">用户登录</a>
					</div>
					
				</div>
				<div class="seven wide column">
					<div class="ui inverted link list">
						<h4 class="ui inverted header m-text-thin m-text-spaced">最新博客</h4>
						<p  class="m-text-thin m-text-spaced m-opacity-mini">这是脏丽丽的个人博客！里面有好多好玩的东西哟！</p>
					</div>
					
				</div>
				
			</div>
			<div class="ui inverted section divider"></div>
			<p class="m-text-thin m-text-spaced m-opacity-tiny">copy right 2019-2020</p>
			</div>
			
		</footer>
		<script>
			//初始化md
				var testEditor;
			
			            $(function() {
			                testEditor = editormd("md-content", {
			                    width   : "100%",
			                    height  : 640,
			                    syncScrolling : "single",
			                    path    : "/lib/md/lib/"
			                });
			                

			            });
			$('.menu.toggle').click(function() {
				$('.m-item').toggleClass('m-mobile-hide');
			});
			
			$('.ui.dropdown').dropdown(
			{
				on:'hover'
			}
			);
			$('.ui.form').form({
				fields:{
						
					title:{
						identifier:'title',
						rules:[{
							type:'empty',
							prompt:'标题！请输入博客标题'
						}]
					},

					content:{
						identifier:'content',
						rules:[{
							type:'empty',
							prompt:'标题！请输入博客内容'
						}]
					},
					typeId:{
						identifier:'typeId',
						rules:[{
							type:'empty',
							prompt:'标题！请输入博客分类'
						}]
					},
					firstPicture:{
						identifier:'firstPicture',
						rules:[{
							type:'empty',
							prompt:'标题！请输入博客标题'
						}]
					}
				}
			})
			$('#save-btn').click(function () {
				$('[name="published"]').val(false);
				$('#blog-form').submit();
			});

			$('#publish-btn').click(function () {
				$('[name="published"]').val(true);
				$('#blog-form').submit();
			});

		</script>
		<th:block th:replace="admin/_fragments::script">

		</th:block>
	</body>
</html>
